package com.simple.chiralium.upms.biz.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.simple.chiralium.upms.api.entity.SysMenu;
import com.simple.chiralium.upms.biz.mapper.SysMenuMapper;
import com.simple.chiralium.upms.biz.mapper.SysRoleMenuMapper;
import com.simple.chiralium.upms.biz.service.SysMenuService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.Set;

/**
 * 系统权限菜单ServiceImpl
 *
 * @author SimpleZzz
 * @date 2021/12/08 13:51:08
 */
@Service
@RequiredArgsConstructor
public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> implements SysMenuService {

    /**
     * 菜单映射器
     */
    private final SysMenuMapper menuMapper;

    /**
     * 角色映射器菜单
     */
    private final SysRoleMenuMapper roleMenuMapper;

    /**
     * 更新菜单
     *
     * @param sysMenu 系统菜单
     */
    @Override
    public void updateMenu(SysMenu sysMenu) {
        this.updateById(sysMenu);
    }

    @Override
    public Set<SysMenu> findMenuByRoleId(Long roleId) {
        return menuMapper.listMenusByRoleId(roleId);
    }
}
